#pragma once
#include <string>
#include <map>
#include "http_controller.h"
#include "http_request.h"

class HttpRequestDispatcher
{
private: 
	HttpRequestDispatcher();
	HttpRequestDispatcher(const HttpRequestDispatcher&) = delete;
	HttpRequestDispatcher(const HttpRequestDispatcher&&) = delete;
	HttpRequestDispatcher& operator=(const HttpRequestDispatcher&) = delete;
	void InitControllerMapping();

public:
	static HttpRequestDispatcher& GetInstace();
	HttpController& HandleRequestMapping(const std::string url);
	void RegisterControllerMapping(const std::string url, HttpController& controller, bool override = false);
private:
	static HttpRequestDispatcher m_pInstance;
	static std::map<const std::string, HttpController&> m_pControllerMap;
};

extern const HttpRequestDispatcher& HTTP_REQUEST_DISPATCHER;